package com.danco.training.zaneuskaya.service.comparator;

import java.io.Serializable;
import java.util.Comparator;

import com.danco.training.zaneuskaya.domain.Order;

public class OrderComparatorByState implements Comparator<Order>, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2549298270566199587L;

	public int compare(Order o1, Order o2) {
		boolean s1 = o1.isExecuted();
		boolean s2 = o2.isExecuted();
		if (s1 == true && s2 == false) {
			return 1;
		} else if (s1 == false && s2 == true) {
			return -1;
		}
		return 0;
	}

}
